<template>
  <div>
    <div>孙子组件:{{money}}</div>
    <button @click='handleClick'>点击</button>
  </div>
</template>
<script>
import { inject } from 'vue'

export default {
  name: 'GrandSon',
  setup () {
    const v = inject('money')
    const fn = inject('getMoneyOfGrandSon')
    const handleClick = () => {
      //  孙子组件把数据传递给爷爷
      fn(60)
    }
    return {
      money: v,
      handleClick
    }
  }
}
</script>
